<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../node_modules/vue/dist/vue.min.js"></script>
</head>
<body>
    <div id="app">
        <input :type="type">
        <br>
        <button @click="changePSW">切换成密码框</button>
        <button @click="changeText">切换成文本框</button>
    </div>

    <script>
        new Vue({
            el:'#app',
            data:{
                type:'text'
            },
            methods:{
                changePSW(){
                    this.type='password';
                },
                changeText(){
                    this.type='text';
                }
            }
        })
    </script>
</body>
</html>